using System;
using System.Collections.Generic;
using System.Text;
using QLNT_DTO;
using System.Data;

namespace QLNT_DAO
{
    public class DangThuoc_dao
    {
        public DangThuoc_dto[] SelectAll()
        {
            DangThuoc_dto[] dtdto = new DangThuoc_dto[100];
            DataTable dt = new DataTable();
            try
            {
                dt = MyExecute.ExecuteQuery("sp_LayDSDangThuoc");
                int n = dt.Rows.Count;
                dtdto = new DangThuoc_dto[n];
                for (int i = 0; i < n; i++)
                {
                    dtdto[i] = new DangThuoc_dto();
                    dtdto[i].MaDangThuoc = int.Parse(dt.Rows[i]["MaDangThuoc"].ToString());
                    dtdto[i].TenDangThuoc= dt.Rows[i]["TenDangThuoc"].ToString();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return dtdto;
        }
    }
}
